package com.ihr360.message.event;

import com.ihr360.message.service.impl.ExecuteSendTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 消息发送监听
 *
 * @author tom
 * @date 17-12-28
 */
@Component
public class MessageSendTaskListener implements ApplicationListener<MessageSendTaskEvent> {

    @Autowired
    private ExecuteSendTaskService executeSendTaskService;

    @Async
    @Override
    public void onApplicationEvent(MessageSendTaskEvent messageSendTaskEvent) {
        executeSendTaskService.execute(messageSendTaskEvent.getTaskId());
    }
}
